// Copyright (C) joyinter
// All rights reserved.
// 
// Author : Jiang Li
// Date   : 2004-6-24

#ifndef __PAGECTRL_H_COMMON_UI__
#define __PAGECTRL_H_COMMON_UI__

#pragma once

#include "wndcontainer.h"
#include "checkbox.h"

class CJoyPageCtrl;
class CJoyPageContainer;
class CJoyPageTabSet;

//##ModelId=44C4B603005D
class CJoyPageContainer : public CJoyWndContainer
{
	DECLARE_DYNAMIC(CJoyPageContainer)
protected:
    friend class CJoyPageCtrl;
    friend class CJoyPageTabSet;

	//##ModelId=44C4B6030060
    CJoyPageCtrl*   m_pageCtrl;

public:
	//##ModelId=44C4B603006D
    CJoyPageContainer();
	//##ModelId=44C4B603006E
    virtual ~CJoyPageContainer(void);
public:
    DECLARE_MESSAGE_MAP()
};

//##ModelId=44C4B6030071
class CJoyPageTabSet : public CJoyWnd
{
	DECLARE_DYNAMIC(CJoyPageTabSet)
protected:
    friend class CJoyPageCtrl;
    friend class CJoyPageContainer;

	//##ModelId=44C4B603007F
    CJoyPageCtrl*   m_pageCtrl;

public:
	//##ModelId=44C4B6030083
    CJoyPageTabSet();
	//##ModelId=44C4B6030084
    virtual ~CJoyPageTabSet(void);
public:
    DECLARE_MESSAGE_MAP()
	//##ModelId=44C4B603008D
    afx_msg void OnSize(UINT nType, int cx, int cy);
};

//##ModelId=44C4B60300AB
class CJoyPageCtrl : public CJoyWnd
{
	DECLARE_DYNAMIC(CJoyPageCtrl)
public:
    friend class CJoyPageContainer;
    friend class CJoyPageTabSet;

	//##ModelId=44C4B603014B
    class CPageItem
    {
    public:
		//##ModelId=44C4B603014D
        CJoyCheckBox*   m_tab;
		//##ModelId=44C4B603015A
        CJoyWnd*        m_page;
		//##ModelId=44C4B603015E
        CString         m_name;
		//##ModelId=44C4B6030167
        CPageItem()
            : m_tab(NULL), m_page(NULL)
        {
        }
    };

	//##ModelId=44C4B60300BD
    unsigned    m_tabSpace;
	//##ModelId=44C4B60300C1
    int         m_tabStart;
	//##ModelId=44C4B60300C3
    CList<CPageItem>    m_items;
	//##ModelId=44C4B60300CC
    CJoyPageContainer*  m_container;
	//##ModelId=44C4B60300D1
    CJoyPageTabSet*     m_tabSet;
	//##ModelId=44C4B60300DB
    CJoyCheckGroup      m_tabGroup;

	//##ModelId=44C4B60300DF
    POSITION GetItemPos(const CString& name);
	//##ModelId=44C4B60300E1
    void BuildTabArea();

	//##ModelId=44C4B60300EA
    void BuildTabAreaLeft();
	//##ModelId=44C4B60300EB
    void BuildTabAreaTop();
	//##ModelId=44C4B60300EC
    void BuildTabAreaRight();
	//##ModelId=44C4B60300ED
    void BuildTabAreaBottom();

	//##ModelId=44C4B60300FA
    virtual CJoyPageContainer* CreateContainer();
	//##ModelId=44C4B60300FC
    virtual CJoyPageTabSet* CreateTabSet();

	//##ModelId=44C4B60300FE
    virtual void CM_LoadSkin(CJoyXmlElement* pSkinElem);
	//##ModelId=44C4B603010A
    virtual void OnSelTab(CJoyCheckBox* box, bool& checked);
public:
	//##ModelId=44C4B603010E
    CJoyPageCtrl(void);
	//##ModelId=44C4B6030119
    virtual ~CJoyPageCtrl(void);

	//##ModelId=44C4B603011C
    void AddPage(const CString& name, CJoyWnd* page);
	//##ModelId=44C4B6030129
    CJoyWnd* RemovePage(const CString& name);

	//##ModelId=44C4B603012B
    void ShowPage(const CString& name, bool show);
	//##ModelId=44C4B603013A
    void SelectPage(const CString& name);
public:
    DECLARE_MESSAGE_MAP()
	//##ModelId=44C4B6030148
    afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
};


#endif  // __PAGECTRL_H_COMMON_UI__
